CLASS lsc_ymoon_i_email DEFINITION INHERITING FROM cl_abap_behavior_saver.

  PROTECTED SECTION.

    METHODS save_modified REDEFINITION.

ENDCLASS.

CLASS lsc_ymoon_i_email IMPLEMENTATION.

  METHOD save_modified.
    DATA(config_instance) = cl_bcs_mail_system_config=>create_instance( ).
    DATA recipient_domains TYPE cl_bcs_mail_system_config=>tyt_recipient_domains.
    IF create IS NOT INITIAL.
      "Add allowed domains
      recipient_domains = VALUE #( FOR domain_cre IN create-ymoon_i_email ( domain_cre-email ) ).
      TRY.
          config_instance->set_address_check_active( abap_true ).
          config_instance->add_allowed_recipient_domains( recipient_domains ).

**        config_instance->modify_default_sender_address( iv_default_address = 'lizhe0315@aspnc.com'
*                                                    iv_default_name = 'Personal Sender' ).
        CATCH cx_bcs_mail_config INTO DATA(write_error_cre).
          "handle exception
          DATA(lv_error_cre) = 'X'.
      ENDTRY.
    ENDIF.

    IF delete IS NOT INITIAL.
      recipient_domains = VALUE #( FOR domain_del IN delete-ymoon_i_email ( domain_del-email ) ).
      TRY.

          config_instance->delete_allowed_rec_domains( recipient_domains ).

**        config_instance->modify_default_sender_address( iv_default_address = 'lizhe0315@aspnc.com'
*                                                    iv_default_name = 'Personal Sender' ).
        CATCH cx_bcs_mail_config INTO DATA(write_error_del).
          "handle exception
          DATA(lv_error_del) = 'X'.
      ENDTRY.
    ENDIF.
  ENDMETHOD.

ENDCLASS.

CLASS lhc_ymoon_i_email DEFINITION INHERITING FROM cl_abap_behavior_handler.
  PRIVATE SECTION.

    METHODS get_instance_authorizations FOR INSTANCE AUTHORIZATION
      IMPORTING keys REQUEST requested_authorizations FOR ymoon_i_email RESULT result.

ENDCLASS.

CLASS lhc_ymoon_i_email IMPLEMENTATION.

  METHOD get_instance_authorizations.
  ENDMETHOD.

ENDCLASS.
